<?php

namespace App\Http\Controllers\Api\V1\Data;

use App\Services\Data\LottoService;
use Illuminate\Http\Request;

class LottoController
{

    private $LottoService;

    public function __construct(LottoService $LottoService)
    {
        $this->LottoService = $LottoService;
    }

  /**
   * 获取数据信息
   * @param Request $request
   * @return mixed
   * @throws \Exception
   */
    public function getLottoList(Request $request)
    {
//        $arrLottoList = $this->LottoService->getNumberData($request->all());
        $arrLottoList = $this->LottoService->getLottoList($request->all());
        return response()->success($arrLottoList);
    }

  /**
   * 根据token获取用户信息
   * @param Request $request
   * @return mixed
   * @throws \Exception
   */
    public function getUserInfo(Request $request)
    {
        $token = $request->header('X-Token');
        if(empty($token)){
          return response()->success(1);
        }
        $this->UserService->checkLogin($token);
        $arrUserData = $this->UserService->getUserInfo($token);
        return response()->success($arrUserData);
    }
}
